package com.carsystem.entity;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.swiftdao.entity.KeyedPersistable;
/**
 * @author JinLiang
 * @datetime 2013-1-15 下午11:00:27
 * @describe 资源实体类
 */
@SuppressWarnings("serial")
@Entity
@Table(name="CS_RESOURCE")
public class ResourceEntity implements KeyedPersistable<Long> {
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="resourceId")
	private Long id;
	@Column(nullable=false,unique=true)
	private int nodeId;
	private int parentId;
	@Column(length=20)
	private String namespace;
	@Column(length=50)
	private String actionPath;
	@ManyToMany(mappedBy="resourceEntities",cascade={CascadeType.REMOVE})
	private Set<RoleEntity>roleEntities;
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public int getNodeId() {
		return nodeId;
	}
	public void setNodeId(int nodeId) {
		this.nodeId = nodeId;
	}
	public int getParentId() {
		return parentId;
	}
	public void setParentId(int parentId) {
		this.parentId = parentId;
	}
	public String getNamespace() {
		return namespace;
	}
	public void setNamespace(String namespace) {
		this.namespace = namespace;
	}
	public String getActionPath() {
		return actionPath;
	}
	public void setActionPath(String actionPath) {
		this.actionPath = actionPath;
	}
	public Set<RoleEntity> getRoleEntities() {
		return roleEntities;
	}
	public void setRoleEntities(Set<RoleEntity> roleEntities) {
		this.roleEntities = roleEntities;
	}
	public ResourceEntity() {
		super();
		// TODO Auto-generated constructor stub
	}
	public ResourceEntity(int nodeId, int parentId, String namespace,
			String actionPath) {
		super();
		this.nodeId = nodeId;
		this.parentId = parentId;
		this.namespace = namespace;
		this.actionPath = actionPath;
	}
	
}
